/**
 *******************************************************************************
 * @FileName  : hci_slip.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-09-10
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms desc ribed
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
#ifndef HCI_SLIP_H_
#define HCI_SLIP_H_

#include "utils/defs_types.h"

#if 0
/*!  Slip decoder/encoder buffer config macro. */
#define HCI_SLIP_DECODE_BUF_SIZE    MEM_SIZE_ALIGN4(HCI_H5_HEAD_LEN + HCI_ACL_BUF_SIZE + HCI_H5_CRC_LEN)
#define HCI_SLIP_ENCODE_BUF_SIZE    MEM_SIZE_ALIGN4(2 + (HCI_H5_HEAD_LEN + HCI_TR_TX_BUF_SIZE + HCI_H5_CRC_LEN) * 2)
#endif

/*! Slip invalid unencoded. */
#define SLIP_INVALID_UNENCODED      0x00

/*! Slip invalid escape. */
#define SLIP_INVALID_ESCAPE         0x0000

#define SLIP_DELIMITER              0xC0
#define SLIP_ESCAPE                 0xDB

typedef void (*HciH5PacketHandler_t)(uint8_t *pPacket, uint32_t len);

/**
 * @brief : Slip initialization.
 * @param : none.
 * @param : none.
 */
void HCI_Slip_Init(void);

/**
 * @brief : Register H5 protocol handler.
 * @param : func    Pointer point to handler function.
 * @param : none.
 */
void HCI_Slip_RegisterPktHandler(HciH5PacketHandler_t func);

/**
 * @brief : Slip send.
 * @param : pPacket   Pointer point to buffer.
 * @param : len       The length of data.
 * @param : none.
 */
bool_t HCI_Slip_Send(uint8_t *pPacket, uint32_t len);

/**
 * @brief : Slip decoder.
 * @param : pPacket   Pointer point to buffer.
 * @param : len       The length of data.
 * @param : none.
 */
void HCI_Slip_DecodePacket(uint8_t *pPacket, uint32_t len);

/**
 * @brief : Slip encoder.
 * @param : pPacket   Pointer point to buffer.
 * @param : len       The length of data.
 * @param : none.
 */
void HCI_Slip_EncodePacket(uint8_t *pPacket, uint32_t len);

/**
 * @brief : Set OOF software flow control enable/disable.
 * @param : enable   enable/disable OOF.
 * @param : none.
 */
void HCI_Slip_SetFlowCtrlEnable(bool_t enable);

#endif /* HCI_SLIP_H_ */


